package com.bee.health;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

public class LoginActivity extends Activity {
	
	EditText et_number;
	EditText et_password;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_login);
		et_number=(EditText) findViewById(R.id.et_number);
		et_password=(EditText) findViewById(R.id.et_password);
		
		enterHome();
	}

	/**
	 * 登录
	 * @param view
	 */
	public void login(View view){
		//如果密码为123456，密码123456，登录成功
		//1.获取内容
		String number = et_number.getText().toString().trim();
		String password = et_password.getText().toString().trim();
		//1.1判断是否为空
		if(TextUtils.isEmpty(number) || TextUtils.isEmpty(password)){
			Toast.makeText(this, "请输入账号和密码", Toast.LENGTH_SHORT).show();
			return;
		}
		if(number=="123456"&&password=="123456"){
			enterHome();
		}
		//3.提示登录成功
		Toast.makeText(this, "登录成功", 0).show();
	}

	private void enterHome() {
		Intent intent =new Intent(LoginActivity.this,HomeActivity.class);
		startActivity(intent);
		finish();
	}

}
